<template>
	<view class="page" :style="themeColor">
		<view class="flex flex-direction flex-wrap align-stretch benben-position-layout flex messageDetails_flex_0"
			:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
			<view class='flex flex-wrap align-center justify-between messageDetails_fd0_0'>
				<view class='flex flex-wrap align-center messageDetails_fd0_0_c0' @tap.stop="handleJumpDiy"
					data-type="back" data-url="1">
					<text class='fu-iconfont2  messageDetails_fd0_0_c0_c0'>&#xE794;</text>
				</view>
				<view class='flex flex-wrap align-center'>
					<text class='messageDetails_fd0_0_c1_c0' v-if="zone_type == 1">新品专区</text>
					<text class='messageDetails_fd0_0_c1_c0' v-if="zone_type == 2">租赁专区</text>
					<text class='messageDetails_fd0_0_c1_c0' v-if="zone_type == 3">维修专区</text>
					<text class='messageDetails_fd0_0_c1_c0' v-if="zone_type == 4">二手专区</text>
				</view>
				<view class='flex align-center justify-end messageDetails_fd0_0_c2'>
				</view>
			</view>
		</view>
		<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
		
		<view class="loading_css" v-if="!isShow">
			<u-loading size="36" color="#4177DD"></u-loading>
			<view class="loading_text">加载中</view>
		</view>
		<block v-else>
			<!---搜索列表flex布局开始-->
			<!-- <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout searchResult_flex_2"
				v-if="column_id=='1' && dataList.length > 0">
				<view class='flex flex-wrap align-start searchResult_fd2_0' v-for="(v, k) in dataList" :key="k" @tap.stop="handleJumpDiy"
					data-type="navigateTo" :data-url="`/pages/homepage/shopDetail/shopDetail?id=${v.id}`">
					<image class='searchResult_fd2_0_c0' mode="aspectFill" :src='v.thumb'></image>
					<view class='flex flex-direction flex-wrap align-stretch flex-sub searchResult_fd2_0_c1'>
						<text class='searchResult_fd2_0_c1_c0'>{{v.goods_name}}</text>
						<view class='flex flex-wrap align-center searchResult_fd2_0_c1_c1'>
							<text>销量</text>
							<text class='searchResult_fd2_0_c1_c1_c1'>{{v.sales_sum}}</text>
							<text>件</text>
						</view>
						<view class='flex flex-wrap align-center'>
							<text class='searchResult_fd2_0_c1_c2_c0'>￥</text>
							<view class=' searchResult_fd2_0_c1_c2_c1'>
								<text class=' searchResult_price1_fd2_0_c1_c2_c1'>{{ v.shop_price | frontPrice }}</text>
								<text class=' searchResult_price2_fd2_0_c1_c2_c1'>{{ v.shop_price | laterPrice }}</text>
							</view>
							<text class='searchResult_fd2_0_c1_c2_c2'>￥</text>
							<view class=' searchResult_fd2_0_c1_c2_c3'>
								<text>{{ v.original_price | frontPrice }}</text>
								<text class=' searchResult_price2_fd2_0_c1_c2_c3'>{{ v.original_price | laterPrice }}</text>
							</view>
						</view>
					</view>
				</view>
				<u-loadmore v-if="last_page > 1" style="padding: 24rpx 0;width: 100%;" :status="status"
					:icon-type="iconType" :load-text="loadText" />
			</view> -->
			<!---搜索列表flex布局结束-->
			<!---为您推荐flex布局开始-->
			<view class="flex flex-wrap align-center benben-flex-layout searchResult_flex_3" v-if="column_id=='2' && dataList.length > 0">
				<view class='flex flex-direction flex-wrap align-stretch searchResult_fd3_0' v-for="(v, k) in dataList" :key="k" @tap.stop="handleJumpDiy"
					data-type="navigateTo" :data-url="`/pages/homepage/shopDetail/shopDetail?id=${v.id}`">
					<image class='searchResult_fd3_0_c0' mode="scaleToFill" :src='v.thumb'></image>
					<view class='flex flex-direction flex-wrap align-stretch searchResult_fd3_0_c1'>
						<text class='flex-sub searchResult_fd3_0_c1_c0'>{{v.goods_name}}</text>
						<view class='flex flex-wrap align-center'>
							<text class='searchResult_fd3_0_c1_c1_c0'>￥</text>
							<view class=' searchResult_fd3_0_c1_c1_c1'>
								<text class=' searchResult_price1_fd3_0_c1_c1_c1'>{{ v.shop_price | frontPrice }}</text>
								<text class=' searchResult_price2_fd3_0_c1_c1_c1'>{{ v.shop_price | laterPrice }}</text>
							</view>
						</view>
						<view class='flex flex-wrap align-center justify-between searchResult_fd3_0_c1_c2'>
							<view class='flex flex-wrap align-center'>
								<text class='searchResult_fd3_0_c1_c2_c0_c0'>￥</text>
								<view class=' searchResult_fd3_0_c1_c2_c0_c1'>
									<text class=' searchResult_price1_fd3_0_c1_c2_c0_c1'>{{ v.original_price | frontPrice }}</text>
									<text class=' searchResult_price2_fd3_0_c1_c2_c0_c1'>{{ v.original_price | laterPrice }}</text>
								</view>
							</view>
							<view class='flex flex-wrap align-center'>
								<text class='searchResult_fd3_0_c1_c2_c1_c0'>销量</text>
								<text class='searchResult_fd3_0_c1_c2_c1_c1'>{{v.sales_sum}}</text>
							</view>
						</view>
					</view>
				</view>
				<u-loadmore v-if="last_page > 1" style="padding: 24rpx 0;width: 100%;" :status="status"
					:icon-type="iconType" :load-text="loadText" />
			</view>
			<!---为您推荐flex布局结束-->
			
			<view class="noData" v-if="dataList.length == 0">
				<image src="/static/empty/no.png"></image>
				<view>暂无商品~</view>
			</view>
		</block>
		
		<u-select v-model="show" :list="list" confirm-color="#4781f5" @confirm="confirm"></u-select>
		
	</view>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'
	export default {
		components: {},

		data() {
			return {
				"minixPagingListsApi": "",
				"pageingListApiMethod": "",
				"allowOnloadGetList": false,
				"column_id": "2",
				"dataList": [],
				"sort_field": "1",
				"sort_type": "asc",
				"keyword": "",
				"cid": "",
				"good_type": "",
				"new_id": "",
				"all_type": "all",
				"price_type": "asc",
				"show": false,
				"zone_type": "",
				"list": [{
						value: '1',
						label: '综合'
					},
					{
						value: '2',
						label: '新品优先'
					}],
				
				"page": 1,
				"is_pull": true,
				"last_page": 1,
				"status": 'loadmore',
				"iconType": 'flower',
				"loadText": {
					loadmore: '轻轻上拉',
					loading: '努力加载中',
					nomore: '我也是有底线的'
				},
				"isShow": false
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {

		},
		onLoad(options) {
			let {
				zone_type
			} = options
			if (zone_type !== undefined) this.zone_type = zone_type
			this.DataListFunc()
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {
			this.page = 1;
			this.is_pull = true;
			this.isShow = false;
			this.DataListFunc()
		},
		onReachBottom(e) {
			if (this.page >= this.last_page) return;
			this.status = 'loading';
			this.page++;
			setTimeout(() => {
					
				if (this.page >= this.last_page) this.status = 'nomore';
				else this.status = 'loading';
				this.is_pull = false;
				this.DataListFunc();
			}, 500)
		},
		onPageScroll(e) {

		},
		methods: {
			//切换列宫格
			switchColumnFunc(id) {
				this.isShow = false;
				this.column_id = id;
				this.isShow = true;
			},
			//添加历史搜索记录
			addHistoryFunc() {
				this.$store.commit('appSearchHistoryAdd', {
					"name": this.keyword
				})
				this.page = 1;
				this.is_pull = true;
				this.isShow = false;
				this.DataListFunc()
			},
			//获取商品列表
			DataListFunc() {
				this.$api.post(global.apiUrls.post6449cd1a6439f, {
					page: this.page,
					from: 'list',
					goods_type: this.zone_type
				}).then(res => {
					// console.log(res);
					uni.stopPullDownRefresh();
					this.isShow = true;
					if (res.data.code == 1) {
						this.last_page = res.data.data.last_page;
						if (this.is_pull) {
							this.dataList = res.data.data.data;
						} else {
							this.dataList = this.dataList.concat(res.data.data.data);
						}
					} else {
						this.$message.info(res.data.msg);
					}
				})
			},
			//列表切换
			switchListFunc(sort_field) {
				this.sort_field = sort_field;
				if (sort_field == 1) {
					// this.sort_type == 'asc'
					this.show = true;
					return;
				} else if (sort_field == 2) {
					if (this.sort_type == 'asc') {
						this.sort_type = 'desc';
					} else {
						this.sort_type = 'asc';
					}
					this.all_type = 'all';
					this.price_type = 'asc';
				} else if (sort_field == 3) {
					if (this.price_type == 'asc') {
						this.price_type = 'desc';
					} else {
						this.price_type = 'asc';
					}
					this.all_type = 'all';
					this.sort_type = 'asc';
				}
				this.page = 1;
				this.is_pull = true;
				this.isShow = false;
				this.DataListFunc()
			},
			confirm(e) {
				if (e[0].value == 1) {
					this.all_type = 'all';
				} else {
					this.all_type = 'new';
				}
				this.sort_type = 'asc';
				this.price_type = 'asc';
				this.page = 1;
				this.is_pull = true;
				this.isShow = false;
				this.DataListFunc()
			},
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: rgba(248, 248, 248, 1);
		background-size: 100% auto !important;
	}
	
	.messageDetails_flex_0 {
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}
	
	.messageDetails_fd0_0_c2 {
		width: 100rpx;
	}
	
	.messageDetails_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333333;
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		max-width: 400rpx;
	}
	
	.messageDetails_fd0_0_c0_c0 {
		font-size: 36rpx;
		color: #333;
		font-weight: 500;
	}
	
	.messageDetails_fd0_0_c0 {
		width: 100rpx;
	}
	
	.messageDetails_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
		line-height: 88rpx;
	}
	

	.searchResult_flex_0 {
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 88rpx;
		background-size: 100% auto !important;
	}

	.searchResult_fd0_0_c3_1 {
		width: 30rpx;
		height: 28rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.searchResult_fd0_0_c3 {
		width: 30rpx;
		height: 28rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.searchResult_fd0_0_c2_c1_c2 {
		width: 16rpx;
		height: 20rpx;
	}

	.searchResult_fd0_0_c2_c1_c1 {
		width: 16rpx;
		height: 20rpx;
	}

	.searchResult_fd0_0_c2_c1_c0 {
		width: 16rpx;
		height: 20rpx;
	}

	.searchResult_fd0_0_c2_c0_1 {
		font-size: 28rpx;
		font-weight: 400;
		color: rgba(59, 157, 255, 1);
		margin: 0rpx 10rpx 0rpx 0rpx;
	}

	.searchResult_fd0_0_c2_c0 {
		font-size: 28rpx;
		font-weight: 400;
		color: rgba(102, 102, 102, 1);
		margin: 0rpx 10rpx 0rpx 0rpx;
	}

	.searchResult_fd0_0_c1_c1_c2 {
		width: 16rpx;
		height: 20rpx;
	}

	.searchResult_fd0_0_c1_c1_c1 {
		width: 16rpx;
		height: 20rpx;
	}

	.searchResult_fd0_0_c1_c1_c0 {
		width: 16rpx;
		height: 20rpx;
	}

	.searchResult_fd0_0_c1_c0_1 {
		font-size: 28rpx;
		font-weight: 400;
		color: rgba(59, 157, 255, 1);
		margin: 0rpx 10rpx 0rpx 0rpx;
	}

	.searchResult_fd0_0_c1_c0 {
		font-size: 28rpx;
		font-weight: 400;
		color: rgba(102, 102, 102, 1);
		margin: 0rpx 10rpx 0rpx 0rpx;
	}

	.searchResult_fd0_0_c0_c0_1 {
		font-size: 28rpx;
		font-weight: 500;
		color: rgba(102, 102, 102, 1);
	}

	.searchResult_fd0_0_c0_c0 {
		font-size: 28rpx;
		font-weight: 500;
		color: rgba(59, 157, 255, 1);
	}

	.searchResult_fd0_0 {
		padding: 0rpx 24rpx 0rpx 40rpx;
	}

	.searchResult_flex_1 {
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.searchResult_fd1_0_c2 {
		width: 40rpx;
		height: 40rpx;
		font-size: 36rpx;
		font-weight: 500;
	}

	.searchResult_fd1_0_c1 {
		background: rgba(249, 249, 249, 1);
		background-size: 100% auto !important;
		border-radius: 34rpx 34rpx 34rpx 34rpx;
		width: 574rpx;
		height: 64rpx;
		padding: 0rpx 24rpx 0rpx 24rpx;
	}
	.input_text {
		font-size: 24rpx;
	}

	.searchResult_fd1_0_c0 {
		font-size: 36rpx;
		color: #333;
		font-weight: 500;
	}

	.searchResult_fd1_0 {
		margin: 0rpx 32rpx 0rpx 32rpx;
	}

	.searchResult_flex_2 {
		border-top: 10px solid rgba(248, 248, 248, 1);
		background: #fff;
		padding: 12rpx 24rpx 12rpx 24rpx;
		background-size: 100% auto !important;
	}

	.searchResult_price2_fd2_0_c1_c2_c3 {
		font-size: 24rpx;
	}

	.searchResult_fd2_0_c1_c2_c3 {
		color: #999999;
		font-size: 24rpx;
		font-weight: 400;
		text-decoration: line-through;
	}

	.searchResult_fd2_0_c1_c2_c2 {
		font-size: 24rpx;
		font-weight: 400;
		color: #999999;
		margin: 0rpx 0rpx 0rpx 16rpx;
		text-decoration: line-through;
	}

	.searchResult_price2_fd2_0_c1_c2_c1 {
		font-size: 22rpx;
	}

	.searchResult_price1_fd2_0_c1_c2_c1 {
		font-size: 32rpx;
		font-weight: 700;
		color: rgba(255, 92, 30, 1);
	}

	.searchResult_fd2_0_c1_c2_c1 {
		color: rgba(255, 92, 30, 1);
		font-weight: 600;
		font-size: 32rpx;
	}

	.searchResult_fd2_0_c1_c2_c0 {
		font-size: 22rpx;
		font-weight: 700;
		color: #FF4133;
	}

	.searchResult_fd2_0_c1_c1_c1 {
		font-size: 24rpx;
		font-weight: 400;
		color: #999999;
	}

	.searchResult_fd2_0_c1_c1 {
		font-size: 24rpx;
		font-weight: 400;
		color: #999999;
		line-height: 35rpx;
		margin: 16rpx 0rpx 23rpx 0rpx;
	}

	.searchResult_fd2_0_c1_c0 {
		-webkit-line-clamp: 2;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		font-size: 28rpx;
		font-weight: 500;
		color: #333333;
	}

	.searchResult_fd2_0_c1 {
		margin: 0rpx 0rpx 0rpx 24rpx;
	}

	.searchResult_fd2_0_c0 {
		width: 200rpx;
		height: 200rpx;
	}

	.searchResult_fd2_0 {
		border-bottom: 1px solid #eee;
		padding: 24rpx 0rpx 24rpx 0rpx;
	}

	.searchResult_flex_3 {
		padding: 0rpx 15rpx 12rpx 15rpx;
	}

	.searchResult_fd3_0_c1_c2_c1_c1 {
		color: #BBBBBB;
		font-size: 22rpx;
		font-weight: 400;
		line-height: 30rpx;
	}

	.searchResult_fd3_0_c1_c2_c1_c0 {
		color: #BBBBBB;
		font-size: 22rpx;
		font-weight: 400;
		line-height: 30rpx;
	}

	.searchResult_price2_fd3_0_c1_c2_c0_c1 {
		font-size: 22rpx;
	}

	.searchResult_price1_fd3_0_c1_c2_c0_c1 {
		font-size: 22rpx;
	}

	.searchResult_fd3_0_c1_c2_c0_c1 {
		color: #BBBBBB;
		font-weight: 400;
		line-height: 30rpx;
		font-size: 22rpx;
		text-decoration: line-through;
	}

	.searchResult_fd3_0_c1_c2_c0_c0 {
		color: #BBBBBB;
		font-size: 22rpx;
		font-weight: 400;
		line-height: 30rpx;
		text-decoration: line-through;
	}

	.searchResult_fd3_0_c1_c2 {
		margin: 10rpx 0rpx 0rpx 0rpx;
	}

	.searchResult_price2_fd3_0_c1_c1_c1 {
		font-size: 22rpx;
	}

	.searchResult_price1_fd3_0_c1_c1_c1 {
		font-size: 32rpx;
		font-weight: 700;
		color: #FF4133;
	}

	.searchResult_fd3_0_c1_c1_c1 {
		color: #E5393C;
		font-weight: 700;
		font-size: 36rpx;
		line-height: 48rpx;
	}

	.searchResult_fd3_0_c1_c1_c0 {
		font-size: 22rpx;
		font-weight: 700;
		color: #FF4133;
	}

	.searchResult_fd3_0_c1_c0 {
		-webkit-line-clamp: 2;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		font-size: 30rpx;
		font-weight: 500;
		color: #222222;
		line-height: 42rpx;
	}

	.searchResult_fd3_0_c1 {
		margin: 24rpx 16rpx 24rpx 16rpx;
	}

	.searchResult_fd3_0_c0 {
		width: 350rpx;
		height: 350rpx;
		border-radius: 16rpx 16rpx 0rpx 0rpx;
	}

	.searchResult_fd3_0 {
		background: rgba(255, 255, 255, 1);
		background-size: 100% auto !important;
		margin: 10rpx 5rpx 5rpx 5rpx;
		width: 350rpx;
	}
</style>